<?php

namespace addons\addons;

use app\common\library\Menu;
use think\Addons as Addons_;

/**
 * Example
 */
class Addons extends Addons_
{

    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        $menu = [[
            'name' => 'addons',
            'title' => '自建插件市场',
            'icon' => 'fa fa-list',
            'sublist' => [[
                'name' => 'addons/lists',
                'title' => '自建插件市场',
                'icon' => 'fa fa-circle-o',
                'sublist' => [
                    ['name' => 'addons/lists/index', 'title' => '查看'],
                    ['name' => 'addons/lists/add', 'title' => '添加'],
                    ['name' => 'addons/lists/edit', 'title' => '编辑'],
                    ['name' => 'addons/lists/del', 'title' => '删除'],
                    ['name' => 'addons/lists/multi', 'title' => '批量更新'],
                ]
            ]]
        ]];
        Menu::create($menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        Menu::delete('addons');
        return true;
    }

    /**
     * 插件启用方法
     */
    public function enable()
    {
        Menu::enable('addons');
    }

    /**
     * 插件禁用方法
     */
    public function disable()
    {
        Menu::disable('addons');
    }

}
